import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '评论标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '评价',
    align: "center",
    dataIndex: 'evaluate'
  },
  {
    title: '评论详情',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '评分',
    align: "center",
    dataIndex: 'rate',
  },
  {
    title: '评论图片',
    align: "center",
    dataIndex: 'pic',
    customRender: render.renderImage,
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText',

  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "状态",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    colProps: { span: 3 },
  },
  {
    label: "评分",
    field: 'rate',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_order_rate"
    },
    colProps: { span: 3 },
  },
  {
    label: "创建人",
    field: 'createBy',
    component: 'JInput',
    colProps: { span: 4 },
  },
  {
    label: '开始日期',
    field: 'beginDate',
    component: 'DatePicker',
    componentProps: {
      // showTime: true,
      valueFormat: 'YYYY-MM-DD 00:00:00'
    },
    colProps: { span: 4 },
  },
  {
    label: '结束日期',
    field: 'endDate',
    component: 'DatePicker',
    componentProps: {
      // showTime: true,
      valueFormat: 'YYYY-MM-DD 23:59:59'
    },
    colProps: { span: 4 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '评论标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '评价',
    field: 'evaluate',
    component: 'Input',
  },
  {
    label: '评论详情',
    field: 'description',
    component: 'InputTextArea',
  },
  {
    label: '评分',
    field: 'rate',
    component: 'InputNumber',
  },
  {
    label: '评论图片',
    field: 'pic',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 5
    },
  },
  {
    label: '状态',
    field: 'status',
    // component: 'Input',
    component: 'JSelectInput',
    componentProps: {
      options: [
        { label: '有效', value: '1' },
        { label: '无效', value: '0' },
      ],
      //是否为搜索模式
      showSearch: true,
      //是否禁用
      disabled: false
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  createTime: { title: '创建时间', order: 0, view: 'datetime', type: 'string', },
  updateTime: { title: '更新时间', order: 1, view: 'datetime', type: 'string', },
  createBy: { title: '创建人', order: 2, view: 'text', type: 'string', },
  updateBy: { title: '更新人', order: 3, view: 'text', type: 'string', },
  title: { title: '评论标题', order: 4, view: 'text', type: 'string', },
  evaluate: { title: '评价', order: 5, view: 'text', type: 'string', },
  description: { title: '评论详情', order: 6, view: 'textarea', type: 'string', },
  rate: { title: '评分', order: 7, view: 'number', type: 'number', },
  pic: { title: '评论图片', order: 8, view: 'image', type: 'string', },
  status: { title: '状态', order: 9, view: 'text', type: 'string', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}